package kr.hkit.powerjava.chther08;

//은행계좌
//소유주 owner
//입금잔액


public class BankAccount {
	private String owner;
	private int accountNumber;
	private int balance;
	
	public BankAccount(String owner, int accountNumber, int balance) {
		this.owner = owner;
		this.accountNumber = accountNumber;
		this.balance = balance;
	}
	public void deposit(int amount){
		balance += amount;
	}
	public int withdraw(int amount){
		if(balance < amount || balance ==0){
			System.out.println("출금 불가 잔액:"+balance);
			return 0;
		}else{
			balance -= amount;
			return amount;
		}
	}
	@Override
	public String toString() {
		return "BankAccount [owner=" + owner + ", accountNumber="
				+ accountNumber + ", balance=" + balance + "]";
	}
}

